import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:management_system/pages/compents/password.dart';
import 'package:management_system/pages/register.dart';

class LoginPage extends StatefulWidget {
  const LoginPage({super.key});

  @override
  State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  bool state = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xFFE3ECFA),
      body: Container(
        padding: const EdgeInsets.all(20),
        alignment: Alignment.center,
        child: ClipRRect(
          borderRadius: BorderRadius.circular(24),
          child: Container(
            child: Row(
              children: [
                Expanded(
                    child: Container(
                  color: const Color(0xFF3F8CFF),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: [
                      Image.asset(
                        "images/login_img.png",
                        width: 424.w,
                      ),
                      SizedBox(height: 140.w),
                    ],
                  ),
                )),
                Expanded(
                    child: Container(
                  padding: EdgeInsets.symmetric(horizontal: 139.w),
                  color: Colors.white,
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      SizedBox(height: 113.w),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Text("欢迎登录",
                              style: TextStyle(
                                      fontWeight: FontWeight.normal,
                                      fontSize: 22)
                                  ),
                        ],
                      ),
                      SizedBox(height: 38.w),
                      Container(
                        margin: EdgeInsets.only(left: 7.w),
                        child: Text("邮箱",
                            style: TextStyle(
                                    color: Color(0xFF7D8592),
                                    fontWeight: FontWeight.w400,
                                    fontSize: 14)
                                ),
                      ),
                      SizedBox(height: 8.w),
                      Container(
                          decoration: BoxDecoration(
                              border: Border.all(
                                color: Color(0xFFD8E0F0),
                              ),
                              borderRadius: BorderRadius.circular(14)),
                          child: TextField(
                            decoration: InputDecoration(
                                border: InputBorder.none,
                                hintText: "请输入邮箱",
                                hintStyle: TextStyle(
                                    color: Color(0xFF7D8592),
                                    fontWeight: FontWeight.w400,
                                    fontSize: 14),
                                contentPadding:
                                    EdgeInsets.symmetric(horizontal: 10)),
                          )),
                      SizedBox(height: 26.w),
                      Container(
                        margin: EdgeInsets.only(left: 7.w),
                        child: Text("密码",
                            style: TextStyle(
                                    color: Color(0xFF7D8592),
                                    fontWeight: FontWeight.w400,
                                    fontSize: 14)
                                ),
                      ),
                      PwdTextField(),
                      SizedBox(height: 35.w),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            mainAxisSize: MainAxisSize.min,
                            children: [
                              Transform.scale(
                                scale: 0.8,
                                child: Checkbox(
                                    value: state,
                                    activeColor: Colors.white,
                                    checkColor: Color(0xFF3F8CFF),
                                    shape: RoundedRectangleBorder(
                                      borderRadius: BorderRadius.circular(2.0),
                                    ),
                                    side: MaterialStateBorderSide.resolveWith(
                                      (states) => BorderSide(
                                          width: 2.0,
                                          color: Color(0XFF0A1629),
                                          strokeAlign: 1),
                                    ),
                                    onChanged: (value) {
                                      setState(() {
                                        state = !state;
                                      });
                                    }),
                              ),
                              Text("记住我",
                                  style: TextStyle(
                                          color: Color(0xFF7D8592),
                                          fontWeight: FontWeight.w400,
                                          fontSize: 14)
                                      )
                            ],
                          ),
                          Text("忘记密码？",
                              style: TextStyle(
                                      color: Color(0xFF7D8592),
                                      fontWeight: FontWeight.w400,
                                      fontSize: 14)
                                  )
                        ],
                      ),
                      SizedBox(height: 52.w),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Column(
                            children: [
                              SizedBox(
                                width: 170.w,
                                child: FilledButton(
                                  style: ElevatedButton.styleFrom(
                                    backgroundColor: Color(0XFF3F8CFF),
                                    shape: RoundedRectangleBorder(
                                        borderRadius:
                                            BorderRadius.circular(14.w)),
                                    shadowColor: const Color.fromRGBO(
                                        196, 203, 214, 0.1036),
                                  ),
                                  onPressed: () {},
                                  child: Text('立即登录',
                                      style: TextStyle(fontSize: 16.w)
                                          ),
                                ),
                              ),
                              SizedBox(height: 18.w),
                              Row(
                                children: [
                                  Text("还没有账号？",
                                      style: TextStyle(
                                              color: Color(0xFF3F8CFF),
                                              fontWeight: FontWeight.w400,
                                              fontSize: 16.w)
                                          ),
                                  InkResponse(
                                    onTap: (){
                                      Navigator.push(context, MaterialPageRoute(builder: (context){
                                        return new RegisterPage();
                                      }));
                                    },
                                    child: Text("去注册",
                                        style: TextStyle(
                                                color: Color(0xFF3F8CFF),
                                                fontWeight: FontWeight.w400,
                                                decoration:
                                                    TextDecoration.underline,
                                                decorationColor:
                                                    Color(0xFF3F8CFF),
                                                fontSize: 16.w)
                                            ),
                                  )
                                ],
                              )
                            ],
                          ),
                        ],
                      )
                    ],
                  ),
                ))
              ],
            ),
          ),
        ),
      ),
    );
  }
}
